import React from 'react'
import styles from '../Home.module.scss'
import {Breadcrumb} from 'antd'
import {Link, matchRoutes, useLocation} from 'react-router-dom'
import {routes} from '../../../router'

export default function HomeBreadcrumb() {
	const location = useLocation()
	const matchs = matchRoutes(routes, location)

	return (
		<Breadcrumb
			className={styles['home-breadcrumb']}
			items={matchs?.map((v) => {
				return {
					title: <Link to={v.pathname}>{v.route.meta?.title}</Link>,
				}
			})}
		/>
	)
}
